<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>欢迎认证</title>
    {include file="common/linkcss" /}
</head>

<body>

    <div class="page__hd">
        <h1 class="page__title">欢迎认证</h1>
        <p class="page__desc">认证个人名片</p>
    </div>

    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" id="name" name="name" placeholder="请输入你的姓名">
            </div>
        </div>
        <div class="weui-cell ">
            <div class="weui-cell__hd">
                <label class="weui-label">手机号</label>
            </div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="tel" id="tel" name="tel" placeholder="请输入手机号">
            </div>
        </div>
    </div>

    <div class="weui-btn-area">
        <a id="checkCard" href="javascript:" class="weui-btn weui-btn_primary">认证名片</a>
    </div>

    {include file="common/footer" /}

    <script>
        $('#checkCard').click(function () {
            $.post("{:url('login/index')}", {
                name: $('#name').val(),
                tel: $('#tel').val(),
            }, function (res) {
                switch (res.state)
                {
                case -1:
                    $.toast("已经被认证过了", "forbidden");
                    break;
                case 0:
                    $.toast("查无此用户", "forbidden");
                    break;
                case 1:
                    $.toast("认证成功!");
                    setTimeout(function () {
                        url = "{:url('index/index',array('uid'=>$uid))}&token=" + res.token;
                        window.location = url;
                    }, 1000);
                    break;
                default:

                }
            })
        });
    </script>
</body>

</html>